﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.Security;

namespace Sausage.Web.Domain
{
    public class Authentication
    {
        public static void Login(string userID, HttpResponse response)
        {
            DateTime expiration = DateTime.Now.AddDays(1);
            FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(1, userID, DateTime.Now, expiration, false, string.Empty);
            HttpCookie cookie = new HttpCookie(FormsAuthentication.FormsCookieName, FormsAuthentication.Encrypt(ticket));
            response.Cookies.Add(cookie);
        }

        public static void Logout()
        {
            FormsAuthentication.SignOut();
        }
    }
}
